{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import torch.nn as nn\n",
    "from torch.utils.data import DataLoader\n",
    "from torchvision.datasets import MNIST\n",
    "from torchvision.transforms import ToTensor\n",
    "# 1. 定义模型结构（必须与保存时的结构完全一致）\n",
    "from model import DigitClassifier"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "模型参数加载成功\n"
     ]
    }
   ],
   "source": [
    "# 2. 创建模型实例并加载保存的参数\n",
    "model = DigitClassifier()\n",
    "\n",
    "# 加载state_dict\n",
    "model.load_state_dict(torch.load(\"./checkpoint/mnist_cnn.pt\", map_location=torch.device('cpu')))\n",
    "print(\"模型参数加载成功\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DigitClassifier(\n",
       "  (conv1): Conv2d(1, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
       "  (conv2): Conv2d(32, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
       "  (conv3): Conv2d(16, 8, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
       "  (fc): Linear(in_features=6272, out_features=10, bias=True)\n",
       ")"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 3. 切换到评估模式（关键步骤！）\n",
    "model.eval()  # 关闭dropout、batchnorm等训练特有的层行为"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_path = \"./data/MNIST\"\n",
    "\n",
    "# 4. 加载评估数据（与训练时保持一致的预处理）\n",
    "test_dataset = MNIST(root=data_path, train=False, transform=ToTensor(), download=True)\n",
    "test_loader = DataLoader(test_dataset, batch_size=32, shuffle=False)\n",
    "\n",
    "# 5. 定义损失函数（评估时也可计算损失）\n",
    "criterion = nn.CrossEntropyLoss()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Experiment 1 评估并且的到准确率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Eval Batch 0\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 2, 1, 0, 4]\n",
      "前5个标签: [7, 2, 1, 0, 4]\n",
      "评估损失: 0.2304，准确率: 0.9688\n",
      "评估损失: 0.2304，准确率: 0.9688\n",
      "\n",
      "Eval Batch 1\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 7, 2, 7]\n",
      "前5个标签: [3, 4, 7, 2, 7]\n",
      "评估损失: 0.1847，准确率: 1.0000\n",
      "评估损失: 0.1847，准确率: 1.0000\n",
      "\n",
      "Eval Batch 2\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 4, 6, 4, 3]\n",
      "前5个标签: [7, 4, 6, 4, 3]\n",
      "评估损失: 0.2003，准确率: 1.0000\n",
      "评估损失: 0.2003，准确率: 1.0000\n",
      "\n",
      "Eval Batch 3\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 7, 6, 9, 6]\n",
      "前5个标签: [1, 7, 6, 9, 6]\n",
      "评估损失: 0.2559，准确率: 0.9688\n",
      "评估损失: 0.2559，准确率: 0.9688\n",
      "\n",
      "Eval Batch 4\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 5, 6, 6, 5]\n",
      "前5个标签: [8, 5, 6, 6, 5]\n",
      "评估损失: 0.1889，准确率: 0.9688\n",
      "评估损失: 0.1889，准确率: 0.9688\n",
      "\n",
      "Eval Batch 5\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 5, 4, 6]\n",
      "前5个标签: [4, 6, 5, 4, 6]\n",
      "评估损失: 0.2989，准确率: 0.9688\n",
      "评估损失: 0.2989，准确率: 0.9688\n",
      "\n",
      "Eval Batch 6\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 9, 0, 3, 1]\n",
      "前5个标签: [0, 9, 0, 3, 1]\n",
      "评估损失: 0.2208，准确率: 1.0000\n",
      "评估损失: 0.2208，准确率: 1.0000\n",
      "\n",
      "Eval Batch 7\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 2, 8, 4, 1]\n",
      "前5个标签: [1, 2, 8, 4, 1]\n",
      "评估损失: 0.3019，准确率: 0.9688\n",
      "评估损失: 0.3019，准确率: 0.9688\n",
      "\n",
      "Eval Batch 8\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 8, 2, 6, 8]\n",
      "前5个标签: [2, 8, 2, 6, 8]\n",
      "评估损失: 0.2349，准确率: 1.0000\n",
      "评估损失: 0.2349，准确率: 1.0000\n",
      "\n",
      "Eval Batch 9\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 5, 2, 9]\n",
      "前5个标签: [1, 5, 8, 2, 9]\n",
      "评估损失: 0.2583，准确率: 0.9375\n",
      "评估损失: 0.2583，准确率: 0.9375\n",
      "\n",
      "Eval Batch 10\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 3, 9, 3, 0]\n",
      "前5个标签: [9, 2, 9, 3, 0]\n",
      "评估损失: 0.3519，准确率: 0.9375\n",
      "评估损失: 0.3519，准确率: 0.9375\n",
      "\n",
      "Eval Batch 11\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 6, 1, 8, 5]\n",
      "前5个标签: [5, 6, 1, 8, 5]\n",
      "评估损失: 0.1856，准确率: 0.9688\n",
      "评估损失: 0.1856，准确率: 0.9688\n",
      "\n",
      "Eval Batch 12\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 1, 6, 2, 1]\n",
      "前5个标签: [6, 1, 6, 2, 1]\n",
      "评估损失: 0.2486，准确率: 1.0000\n",
      "评估损失: 0.2486，准确率: 1.0000\n",
      "\n",
      "Eval Batch 13\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 9, 2, 1, 4]\n",
      "前5个标签: [1, 9, 2, 1, 4]\n",
      "评估损失: 0.2852，准确率: 0.9688\n",
      "评估损失: 0.2852，准确率: 0.9688\n",
      "\n",
      "Eval Batch 14\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 5, 3, 3, 2]\n",
      "前5个标签: [9, 3, 3, 3, 2]\n",
      "评估损失: 0.2327，准确率: 0.9688\n",
      "评估损失: 0.2327，准确率: 0.9688\n",
      "\n",
      "Eval Batch 15\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 9, 7, 5, 4]\n",
      "前5个标签: [1, 9, 7, 5, 4]\n",
      "评估损失: 0.2297，准确率: 1.0000\n",
      "评估损失: 0.2297，准确率: 1.0000\n",
      "\n",
      "Eval Batch 16\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 2, 6, 3, 2]\n",
      "前5个标签: [2, 2, 6, 3, 2]\n",
      "评估损失: 0.2035，准确率: 1.0000\n",
      "评估损失: 0.2035，准确率: 1.0000\n",
      "\n",
      "Eval Batch 17\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 0, 0, 2, 3]\n",
      "前5个标签: [4, 0, 0, 2, 3]\n",
      "评估损失: 0.2928，准确率: 0.9688\n",
      "评估损失: 0.2928，准确率: 0.9688\n",
      "\n",
      "Eval Batch 18\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 3, 3, 7, 8]\n",
      "前5个标签: [3, 3, 3, 7, 8]\n",
      "评估损失: 0.2676，准确率: 0.9375\n",
      "评估损失: 0.2676，准确率: 0.9375\n",
      "\n",
      "Eval Batch 19\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 2, 4, 0, 2]\n",
      "前5个标签: [0, 2, 4, 0, 2]\n",
      "评估损失: 0.2359，准确率: 0.9688\n",
      "评估损失: 0.2359，准确率: 0.9688\n",
      "\n",
      "Eval Batch 20\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 8, 0, 2, 0]\n",
      "前5个标签: [1, 8, 0, 2, 0]\n",
      "评估损失: 0.2447，准确率: 0.9688\n",
      "评估损失: 0.2447，准确率: 0.9688\n",
      "\n",
      "Eval Batch 21\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 9, 5, 1, 7]\n",
      "前5个标签: [1, 9, 5, 1, 7]\n",
      "评估损失: 0.2922，准确率: 0.9688\n",
      "评估损失: 0.2922，准确率: 0.9688\n",
      "\n",
      "Eval Batch 22\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 7, 9, 4, 4]\n",
      "前5个标签: [0, 7, 9, 4, 4]\n",
      "评估损失: 0.2926，准确率: 0.9688\n",
      "评估损失: 0.2926，准确率: 0.9688\n",
      "\n",
      "Eval Batch 23\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 2, 5, 9]\n",
      "前5个标签: [4, 6, 2, 5, 4]\n",
      "评估损失: 0.2296，准确率: 0.9688\n",
      "评估损失: 0.2296，准确率: 0.9688\n",
      "\n",
      "Eval Batch 24\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 6, 4, 7, 1]\n",
      "前5个标签: [1, 6, 4, 7, 1]\n",
      "评估损失: 0.2688，准确率: 0.9688\n",
      "评估损失: 0.2688，准确率: 0.9688\n",
      "\n",
      "Eval Batch 25\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 3, 4, 4, 0]\n",
      "前5个标签: [8, 3, 4, 4, 0]\n",
      "评估损失: 0.1658，准确率: 1.0000\n",
      "评估损失: 0.1658，准确率: 1.0000\n",
      "\n",
      "Eval Batch 26\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 9, 6, 1, 1]\n",
      "前5个标签: [7, 9, 6, 1, 1]\n",
      "评估损失: 0.3223，准确率: 0.9062\n",
      "评估损失: 0.3223，准确率: 0.9062\n",
      "\n",
      "Eval Batch 27\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 3, 5, 2, 2]\n",
      "前5个标签: [8, 3, 5, 2, 2]\n",
      "评估损失: 0.2830，准确率: 0.9375\n",
      "评估损失: 0.2830，准确率: 0.9375\n",
      "\n",
      "Eval Batch 28\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 5, 7, 8, 3]\n",
      "前5个标签: [0, 5, 7, 8, 1]\n",
      "评估损失: 0.2555，准确率: 0.9688\n",
      "评估损失: 0.2555，准确率: 0.9688\n",
      "\n",
      "Eval Batch 29\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 1, 7, 4, 0]\n",
      "前5个标签: [9, 1, 7, 4, 0]\n",
      "评估损失: 0.3720，准确率: 0.9375\n",
      "评估损失: 0.3720，准确率: 0.9375\n",
      "\n",
      "Eval Batch 30\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 1, 1]\n",
      "前5个标签: [7, 8, 9, 1, 1]\n",
      "评估损失: 0.2513，准确率: 1.0000\n",
      "评估损失: 0.2513，准确率: 1.0000\n",
      "\n",
      "Eval Batch 31\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 0, 1, 2, 2]\n",
      "前5个标签: [9, 0, 1, 2, 2]\n",
      "评估损失: 0.3240，准确率: 0.9688\n",
      "评估损失: 0.3240，准确率: 0.9688\n",
      "\n",
      "Eval Batch 32\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 1, 8, 1, 3]\n",
      "前5个标签: [4, 1, 8, 1, 3]\n",
      "评估损失: 0.3055，准确率: 0.9688\n",
      "评估损失: 0.3055，准确率: 0.9688\n",
      "\n",
      "Eval Batch 33\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 4, 9, 4, 4]\n",
      "前5个标签: [2, 4, 9, 4, 4]\n",
      "评估损失: 0.1844，准确率: 1.0000\n",
      "评估损失: 0.1844，准确率: 1.0000\n",
      "\n",
      "Eval Batch 34\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 5, 9, 7, 3]\n",
      "前5个标签: [9, 5, 9, 7, 3]\n",
      "评估损失: 0.2150，准确率: 0.9688\n",
      "评估损失: 0.2150，准确率: 0.9688\n",
      "\n",
      "Eval Batch 35\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 0, 7, 6, 8]\n",
      "前5个标签: [8, 0, 7, 6, 8]\n",
      "评估损失: 0.2187，准确率: 1.0000\n",
      "评估损失: 0.2187，准确率: 1.0000\n",
      "\n",
      "Eval Batch 36\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 6, 0, 2, 7]\n",
      "前5个标签: [9, 6, 0, 2, 7]\n",
      "评估损失: 0.2658，准确率: 1.0000\n",
      "评估损失: 0.2658，准确率: 1.0000\n",
      "\n",
      "Eval Batch 37\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 8, 7, 2, 0]\n",
      "前5个标签: [2, 8, 7, 2, 0]\n",
      "评估损失: 0.2340，准确率: 1.0000\n",
      "评估损失: 0.2340，准确率: 1.0000\n",
      "\n",
      "Eval Batch 38\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 9, 0, 8, 0]\n",
      "前5个标签: [7, 9, 0, 8, 0]\n",
      "评估损失: 0.4465，准确率: 0.8750\n",
      "评估损失: 0.4465，准确率: 0.8750\n",
      "\n",
      "Eval Batch 39\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 8, 6, 2, 5]\n",
      "前5个标签: [8, 8, 6, 2, 5]\n",
      "评估损失: 0.2846，准确率: 0.9688\n",
      "评估损失: 0.2846，准确率: 0.9688\n",
      "\n",
      "Eval Batch 40\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 9, 7, 3]\n",
      "前5个标签: [1, 5, 9, 7, 3]\n",
      "评估损失: 0.2011，准确率: 1.0000\n",
      "评估损失: 0.2011，准确率: 1.0000\n",
      "\n",
      "Eval Batch 41\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 4, 4, 3, 1]\n",
      "前5个标签: [8, 4, 4, 3, 1]\n",
      "评估损失: 0.2628，准确率: 0.9375\n",
      "评估损失: 0.2628，准确率: 0.9375\n",
      "\n",
      "Eval Batch 42\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 7, 7, 2]\n",
      "前5个标签: [6, 2, 7, 7, 2]\n",
      "评估损失: 0.2155，准确率: 1.0000\n",
      "评估损失: 0.2155，准确率: 1.0000\n",
      "\n",
      "Eval Batch 43\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 6, 5, 0, 9]\n",
      "前5个标签: [5, 6, 5, 0, 9]\n",
      "评估损失: 0.2814，准确率: 0.9375\n",
      "评估损失: 0.2814，准确率: 0.9375\n",
      "\n",
      "Eval Batch 44\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 2, 2, 0, 2]\n",
      "前5个标签: [0, 2, 2, 0, 2]\n",
      "评估损失: 0.3676，准确率: 0.9375\n",
      "评估损失: 0.3676，准确率: 0.9375\n",
      "\n",
      "Eval Batch 45\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 8, 3, 8, 6]\n",
      "前5个标签: [4, 8, 3, 8, 6]\n",
      "评估损失: 0.2287，准确率: 0.9688\n",
      "评估损失: 0.2287，准确率: 0.9688\n",
      "\n",
      "Eval Batch 46\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 5, 8, 6, 5]\n",
      "前5个标签: [3, 5, 8, 6, 5]\n",
      "评估损失: 0.1900，准确率: 1.0000\n",
      "评估损失: 0.1900，准确率: 1.0000\n",
      "\n",
      "Eval Batch 47\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 7, 2, 7, 9]\n",
      "前5个标签: [0, 7, 2, 7, 9]\n",
      "评估损失: 0.3432，准确率: 0.9688\n",
      "评估损失: 0.3432，准确率: 0.9688\n",
      "\n",
      "Eval Batch 48\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 6, 2, 3, 7]\n",
      "前5个标签: [6, 6, 2, 3, 7]\n",
      "评估损失: 0.3336，准确率: 0.9375\n",
      "评估损失: 0.3336，准确率: 0.9375\n",
      "\n",
      "Eval Batch 49\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 6, 6, 4, 8]\n",
      "前5个标签: [8, 6, 0, 4, 8]\n",
      "评估损失: 0.2468，准确率: 0.9375\n",
      "评估损失: 0.2468，准确率: 0.9375\n",
      "\n",
      "Eval Batch 50\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 3, 6, 1, 2]\n",
      "前5个标签: [3, 3, 6, 1, 2]\n",
      "评估损失: 0.2998，准确率: 0.9375\n",
      "评估损失: 0.2998，准确率: 0.9375\n",
      "\n",
      "Eval Batch 51\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 1, 4, 5, 4]\n",
      "前5个标签: [6, 1, 4, 5, 4]\n",
      "评估损失: 0.1852，准确率: 1.0000\n",
      "评估损失: 0.1852，准确率: 1.0000\n",
      "\n",
      "Eval Batch 52\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 4, 9, 1, 9]\n",
      "前5个标签: [8, 4, 9, 1, 9]\n",
      "评估损失: 0.3232，准确率: 0.9688\n",
      "评估损失: 0.3232，准确率: 0.9688\n",
      "\n",
      "Eval Batch 53\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 9, 6, 7, 0]\n",
      "前5个标签: [2, 9, 6, 7, 0]\n",
      "评估损失: 0.3701，准确率: 0.9375\n",
      "评估损失: 0.3701，准确率: 0.9375\n",
      "\n",
      "Eval Batch 54\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 1, 3, 3, 9]\n",
      "前5个标签: [1, 1, 3, 3, 9]\n",
      "评估损失: 0.2564，准确率: 0.9688\n",
      "评估损失: 0.2564，准确率: 0.9688\n",
      "\n",
      "Eval Batch 55\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 0, 3, 0]\n",
      "前5个标签: [1, 5, 0, 3, 0]\n",
      "评估损失: 0.2861，准确率: 1.0000\n",
      "评估损失: 0.2861，准确率: 1.0000\n",
      "\n",
      "Eval Batch 56\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 9, 0, 2, 0]\n",
      "前5个标签: [7, 9, 0, 2, 0]\n",
      "评估损失: 0.2438，准确率: 1.0000\n",
      "评估损失: 0.2438，准确率: 1.0000\n",
      "\n",
      "Eval Batch 57\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 9, 0, 8, 3]\n",
      "前5个标签: [2, 9, 0, 8, 3]\n",
      "评估损失: 0.2588，准确率: 1.0000\n",
      "评估损失: 0.2588，准确率: 1.0000\n",
      "\n",
      "Eval Batch 58\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 6, 6, 8, 5]\n",
      "前5个标签: [3, 6, 6, 8, 5]\n",
      "评估损失: 0.3025，准确率: 0.9375\n",
      "评估损失: 0.3025，准确率: 0.9375\n",
      "\n",
      "Eval Batch 59\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 3, 2, 2, 0]\n",
      "前5个标签: [6, 3, 2, 2, 0]\n",
      "评估损失: 0.3244，准确率: 0.9062\n",
      "评估损失: 0.3244，准确率: 0.9062\n",
      "\n",
      "Eval Batch 60\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 1, 3, 4]\n",
      "前5个标签: [4, 6, 1, 3, 4]\n",
      "评估损失: 0.1857，准确率: 1.0000\n",
      "评估损失: 0.1857，准确率: 1.0000\n",
      "\n",
      "Eval Batch 61\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 3, 5, 8, 4]\n",
      "前5个标签: [9, 3, 5, 8, 4]\n",
      "评估损失: 0.1791，准确率: 1.0000\n",
      "评估损失: 0.1791，准确率: 1.0000\n",
      "\n",
      "Eval Batch 62\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 4, 1, 0, 1]\n",
      "前5个标签: [2, 4, 1, 0, 1]\n",
      "评估损失: 0.2869，准确率: 1.0000\n",
      "评估损失: 0.2869，准确率: 1.0000\n",
      "\n",
      "Eval Batch 63\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 1, 3, 9, 3]\n",
      "前5个标签: [7, 1, 1, 9, 3]\n",
      "评估损失: 0.3845，准确率: 0.9062\n",
      "评估损失: 0.3845，准确率: 0.9062\n",
      "\n",
      "Eval Batch 64\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 9, 8, 1, 8]\n",
      "前5个标签: [7, 9, 8, 1, 8]\n",
      "评估损失: 0.3118，准确率: 0.9375\n",
      "评估损失: 0.3118，准确率: 0.9375\n",
      "\n",
      "Eval Batch 65\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 0, 2, 3, 4]\n",
      "前5个标签: [3, 0, 2, 3, 4]\n",
      "评估损失: 0.2944，准确率: 0.9375\n",
      "评估损失: 0.2944，准确率: 0.9375\n",
      "\n",
      "Eval Batch 66\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 5, 5, 7, 6]\n",
      "前5个标签: [2, 5, 5, 7, 6]\n",
      "评估损失: 0.3521，准确率: 0.8750\n",
      "评估损失: 0.3521，准确率: 0.8750\n",
      "\n",
      "Eval Batch 67\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 4, 8, 9, 4]\n",
      "前5个标签: [6, 4, 8, 9, 4]\n",
      "评估损失: 0.2292，准确率: 1.0000\n",
      "评估损失: 0.2292，准确率: 1.0000\n",
      "\n",
      "Eval Batch 68\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 8, 0, 8, 5]\n",
      "前5个标签: [2, 8, 0, 8, 5]\n",
      "评估损失: 0.3361，准确率: 0.9062\n",
      "评估损失: 0.3361，准确率: 0.9062\n",
      "\n",
      "Eval Batch 69\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 0, 6, 8, 9]\n",
      "前5个标签: [8, 0, 6, 8, 9]\n",
      "评估损失: 0.2152，准确率: 1.0000\n",
      "评估损失: 0.2152，准确率: 1.0000\n",
      "\n",
      "Eval Batch 70\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 5, 2, 7, 9]\n",
      "前5个标签: [7, 5, 2, 7, 9]\n",
      "评估损失: 0.2318，准确率: 1.0000\n",
      "评估损失: 0.2318，准确率: 1.0000\n",
      "\n",
      "Eval Batch 71\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 1, 9, 7, 1]\n",
      "前5个标签: [8, 1, 9, 7, 1]\n",
      "评估损失: 0.3526，准确率: 0.9375\n",
      "评估损失: 0.3526，准确率: 0.9375\n",
      "\n",
      "Eval Batch 72\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 3, 4, 4, 3]\n",
      "前5个标签: [0, 3, 4, 4, 3]\n",
      "评估损失: 0.2328，准确率: 0.9688\n",
      "评估损失: 0.2328，准确率: 0.9688\n",
      "\n",
      "Eval Batch 73\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 4, 5, 4]\n",
      "前5个标签: [4, 6, 4, 5, 4]\n",
      "评估损失: 0.1576，准确率: 1.0000\n",
      "评估损失: 0.1576，准确率: 1.0000\n",
      "\n",
      "Eval Batch 74\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 3, 0, 4, 7]\n",
      "前5个标签: [4, 5, 0, 4, 7]\n",
      "评估损失: 0.3399，准确率: 0.9375\n",
      "评估损失: 0.3399，准确率: 0.9375\n",
      "\n",
      "Eval Batch 75\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 4, 4, 0, 4]\n",
      "前5个标签: [5, 4, 4, 0, 4]\n",
      "评估损失: 0.3114，准确率: 0.9688\n",
      "评估损失: 0.3114，准确率: 0.9688\n",
      "\n",
      "Eval Batch 76\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 2, 1, 0, 4]\n",
      "前5个标签: [2, 2, 1, 0, 4]\n",
      "评估损失: 0.3101，准确率: 0.8750\n",
      "评估损失: 0.3101，准确率: 0.8750\n",
      "\n",
      "Eval Batch 77\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 6, 8, 6]\n",
      "前5个标签: [4, 6, 6, 8, 6]\n",
      "评估损失: 0.2169，准确率: 0.9688\n",
      "评估损失: 0.2169，准确率: 0.9688\n",
      "\n",
      "Eval Batch 78\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 9, 4, 4, 2]\n",
      "前5个标签: [2, 9, 4, 4, 2]\n",
      "评估损失: 0.2411，准确率: 1.0000\n",
      "评估损失: 0.2411，准确率: 1.0000\n",
      "\n",
      "Eval Batch 79\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 1, 4, 0, 6]\n",
      "前5个标签: [9, 1, 4, 0, 6]\n",
      "评估损失: 0.1757，准确率: 1.0000\n",
      "评估损失: 0.1757，准确率: 1.0000\n",
      "\n",
      "Eval Batch 80\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 8, 6, 7, 7]\n",
      "前5个标签: [3, 8, 6, 7, 7]\n",
      "评估损失: 0.2431，准确率: 1.0000\n",
      "评估损失: 0.2431，准确率: 1.0000\n",
      "\n",
      "Eval Batch 81\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 0, 3, 7, 2]\n",
      "前5个标签: [0, 0, 3, 7, 2]\n",
      "评估损失: 0.2068，准确率: 0.9688\n",
      "评估损失: 0.2068，准确率: 0.9688\n",
      "\n",
      "Eval Batch 82\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 2, 1, 0, 7]\n",
      "前5个标签: [3, 2, 1, 0, 7]\n",
      "评估损失: 0.2882，准确率: 0.9375\n",
      "评估损失: 0.2882，准确率: 0.9375\n",
      "\n",
      "Eval Batch 83\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 0, 4, 4, 0]\n",
      "前5个标签: [0, 0, 4, 4, 0]\n",
      "评估损失: 0.2205，准确率: 1.0000\n",
      "评估损失: 0.2205，准确率: 1.0000\n",
      "\n",
      "Eval Batch 84\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 3, 8, 9]\n",
      "前5个标签: [1, 5, 3, 8, 9]\n",
      "评估损失: 0.2918，准确率: 1.0000\n",
      "评估损失: 0.2918，准确率: 1.0000\n",
      "\n",
      "Eval Batch 85\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 6, 1, 3, 8]\n",
      "前5个标签: [9, 6, 1, 3, 8]\n",
      "评估损失: 0.2833，准确率: 0.9688\n",
      "评估损失: 0.2833，准确率: 0.9688\n",
      "\n",
      "Eval Batch 86\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 1, 6, 9, 3]\n",
      "前5个标签: [2, 1, 6, 9, 3]\n",
      "评估损失: 0.2815，准确率: 1.0000\n",
      "评估损失: 0.2815，准确率: 1.0000\n",
      "\n",
      "Eval Batch 87\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 3, 1, 2, 1]\n",
      "前5个标签: [2, 3, 1, 2, 1]\n",
      "评估损失: 0.1804，准确率: 1.0000\n",
      "评估损失: 0.1804，准确率: 1.0000\n",
      "\n",
      "Eval Batch 88\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 0, 4, 4, 7]\n",
      "前5个标签: [1, 0, 4, 4, 7]\n",
      "评估损失: 0.2513，准确率: 1.0000\n",
      "评估损失: 0.2513，准确率: 1.0000\n",
      "\n",
      "Eval Batch 89\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 8, 5, 7, 8]\n",
      "前5个标签: [2, 8, 5, 7, 8]\n",
      "评估损失: 0.2565，准确率: 1.0000\n",
      "评估损失: 0.2565，准确率: 1.0000\n",
      "\n",
      "Eval Batch 90\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 3, 4, 9, 3]\n",
      "前5个标签: [1, 3, 4, 9, 3]\n",
      "评估损失: 0.3423，准确率: 0.9375\n",
      "评估损失: 0.3423，准确率: 0.9375\n",
      "\n",
      "Eval Batch 91\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 3, 7, 9]\n",
      "前5个标签: [1, 5, 3, 7, 9]\n",
      "评估损失: 0.3508，准确率: 0.9375\n",
      "评估损失: 0.3508，准确率: 0.9375\n",
      "\n",
      "Eval Batch 92\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 3, 1, 6, 5]\n",
      "前5个标签: [0, 3, 1, 6, 5]\n",
      "评估损失: 0.2970，准确率: 0.9062\n",
      "评估损失: 0.2970，准确率: 0.9062\n",
      "\n",
      "Eval Batch 93\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 3, 9, 6]\n",
      "前5个标签: [6, 2, 3, 9, 6]\n",
      "评估损失: 0.2758，准确率: 1.0000\n",
      "评估损失: 0.2758，准确率: 1.0000\n",
      "\n",
      "Eval Batch 94\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 7, 3, 7, 8]\n",
      "前5个标签: [9, 7, 3, 7, 8]\n",
      "评估损失: 0.2965，准确率: 0.9375\n",
      "评估损失: 0.2965，准确率: 0.9375\n",
      "\n",
      "Eval Batch 95\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 9, 4, 0, 0]\n",
      "前5个标签: [7, 9, 4, 0, 0]\n",
      "评估损失: 0.2718，准确率: 0.9375\n",
      "评估损失: 0.2718，准确率: 0.9375\n",
      "\n",
      "Eval Batch 96\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 2, 3, 9, 4]\n",
      "前5个标签: [8, 1, 3, 9, 4]\n",
      "评估损失: 0.2266，准确率: 0.9688\n",
      "评估损失: 0.2266，准确率: 0.9688\n",
      "\n",
      "Eval Batch 97\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 2, 2, 7, 3]\n",
      "前5个标签: [3, 2, 2, 7, 3]\n",
      "评估损失: 0.3473，准确率: 0.9375\n",
      "评估损失: 0.3473，准确率: 0.9375\n",
      "\n",
      "Eval Batch 98\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 4, 3, 8, 0]\n",
      "前5个标签: [7, 4, 3, 8, 0]\n",
      "评估损失: 0.1741，准确率: 1.0000\n",
      "评估损失: 0.1741，准确率: 1.0000\n",
      "\n",
      "Eval Batch 99\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 0, 5, 9]\n",
      "前5个标签: [9, 4, 0, 5, 4]\n",
      "评估损失: 0.2197，准确率: 0.9688\n",
      "评估损失: 0.2197，准确率: 0.9688\n",
      "\n",
      "Eval Batch 100\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 2, 7, 1, 8]\n",
      "前5个标签: [9, 2, 7, 1, 8]\n",
      "评估损失: 0.3525，准确率: 0.9688\n",
      "评估损失: 0.3525，准确率: 0.9688\n",
      "\n",
      "Eval Batch 101\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 4, 4, 4, 7]\n",
      "前5个标签: [4, 4, 4, 4, 7]\n",
      "评估损失: 0.2792，准确率: 0.9688\n",
      "评估损失: 0.2792，准确率: 0.9688\n",
      "\n",
      "Eval Batch 102\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 0, 0, 2, 1]\n",
      "前5个标签: [1, 0, 0, 2, 1]\n",
      "评估损失: 0.2127，准确率: 1.0000\n",
      "评估损失: 0.2127，准确率: 1.0000\n",
      "\n",
      "Eval Batch 103\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 0, 4, 3, 3]\n",
      "前5个标签: [7, 0, 4, 3, 3]\n",
      "评估损失: 0.2305，准确率: 1.0000\n",
      "评估损失: 0.2305，准确率: 1.0000\n",
      "\n",
      "Eval Batch 104\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 7, 3, 6, 4]\n",
      "前5个标签: [7, 7, 2, 6, 4]\n",
      "评估损失: 0.2731，准确率: 0.9688\n",
      "评估损失: 0.2731，准确率: 0.9688\n",
      "\n",
      "Eval Batch 105\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 7, 6, 3, 8]\n",
      "前5个标签: [7, 7, 6, 3, 8]\n",
      "评估损失: 0.2364，准确率: 0.9688\n",
      "评估损失: 0.2364，准确率: 0.9688\n",
      "\n",
      "Eval Batch 106\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 5, 9, 6, 2]\n",
      "前5个标签: [9, 5, 9, 6, 2]\n",
      "评估损失: 0.1749，准确率: 1.0000\n",
      "评估损失: 0.1749，准确率: 1.0000\n",
      "\n",
      "Eval Batch 107\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 7, 9, 6, 6]\n",
      "前5个标签: [6, 7, 9, 6, 6]\n",
      "评估损失: 0.2826，准确率: 0.9688\n",
      "评估损失: 0.2826，准确率: 0.9688\n",
      "\n",
      "Eval Batch 108\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 6, 0, 9, 9]\n",
      "前5个标签: [3, 1, 0, 9, 9]\n",
      "评估损失: 0.2051，准确率: 0.9688\n",
      "评估损失: 0.2051，准确率: 0.9688\n",
      "\n",
      "Eval Batch 109\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 4, 9, 8]\n",
      "前5个标签: [6, 2, 4, 9, 8]\n",
      "评估损失: 0.3016，准确率: 1.0000\n",
      "评估损失: 0.3016，准确率: 1.0000\n",
      "\n",
      "Eval Batch 110\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 8, 2, 4, 6]\n",
      "前5个标签: [6, 8, 2, 4, 6]\n",
      "评估损失: 0.2973，准确率: 0.9375\n",
      "评估损失: 0.2973，准确率: 0.9375\n",
      "\n",
      "Eval Batch 111\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 9, 6, 8, 5]\n",
      "前5个标签: [5, 9, 6, 8, 5]\n",
      "评估损失: 0.3256，准确率: 0.9375\n",
      "评估损失: 0.3256，准确率: 0.9375\n",
      "\n",
      "Eval Batch 112\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 7, 1, 9, 8]\n",
      "前5个标签: [0, 7, 1, 9, 8]\n",
      "评估损失: 0.2442，准确率: 0.9688\n",
      "评估损失: 0.2442，准确率: 0.9688\n",
      "\n",
      "Eval Batch 113\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 6, 9, 5, 3]\n",
      "前5个标签: [7, 6, 9, 5, 3]\n",
      "评估损失: 0.2226，准确率: 0.9688\n",
      "评估损失: 0.2226，准确率: 0.9688\n",
      "\n",
      "Eval Batch 114\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 1, 0, 1, 1]\n",
      "前5个标签: [1, 1, 0, 1, 1]\n",
      "评估损失: 0.2187，准确率: 0.9688\n",
      "评估损失: 0.2187，准确率: 0.9688\n",
      "\n",
      "Eval Batch 115\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 8, 2, 6, 4]\n",
      "前5个标签: [0, 2, 2, 6, 4]\n",
      "评估损失: 0.2288，准确率: 0.9375\n",
      "评估损失: 0.2288，准确率: 0.9375\n",
      "\n",
      "Eval Batch 116\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 7, 6, 3, 9]\n",
      "前5个标签: [6, 7, 6, 3, 9]\n",
      "评估损失: 0.3045，准确率: 0.9062\n",
      "评估损失: 0.3045，准确率: 0.9062\n",
      "\n",
      "Eval Batch 117\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 1, 3, 1, 6]\n",
      "前5个标签: [6, 1, 3, 1, 6]\n",
      "评估损失: 0.3072，准确率: 0.9375\n",
      "评估损失: 0.3072，准确率: 0.9375\n",
      "\n",
      "Eval Batch 118\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 1, 5, 1, 6]\n",
      "前5个标签: [5, 1, 5, 1, 4]\n",
      "评估损失: 0.3212，准确率: 0.9688\n",
      "评估损失: 0.3212，准确率: 0.9688\n",
      "\n",
      "Eval Batch 119\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 1, 5, 3, 3]\n",
      "前5个标签: [7, 1, 5, 2, 3]\n",
      "评估损失: 0.3355，准确率: 0.9375\n",
      "评估损失: 0.3355，准确率: 0.9375\n",
      "\n",
      "Eval Batch 120\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 9, 1, 2]\n",
      "前5个标签: [9, 4, 9, 1, 2]\n",
      "评估损失: 0.2750，准确率: 0.9688\n",
      "评估损失: 0.2750，准确率: 0.9688\n",
      "\n",
      "Eval Batch 121\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 8, 9, 4, 2]\n",
      "前5个标签: [9, 8, 9, 4, 2]\n",
      "评估损失: 0.1946，准确率: 0.9688\n",
      "评估损失: 0.1946，准确率: 0.9688\n",
      "\n",
      "Eval Batch 122\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 8, 2, 5, 6]\n",
      "前5个标签: [2, 8, 1, 5, 6]\n",
      "评估损失: 0.1869，准确率: 0.9688\n",
      "评估损失: 0.1869，准确率: 0.9688\n",
      "\n",
      "Eval Batch 123\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 1, 4, 6, 0]\n",
      "前5个标签: [7, 1, 4, 6, 0]\n",
      "评估损失: 0.2638，准确率: 0.9375\n",
      "评估损失: 0.2638，准确率: 0.9375\n",
      "\n",
      "Eval Batch 124\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 7, 9, 4, 6]\n",
      "前5个标签: [5, 7, 9, 4, 6]\n",
      "评估损失: 0.2747，准确率: 1.0000\n",
      "评估损失: 0.2747，准确率: 1.0000\n",
      "\n",
      "Eval Batch 125\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 3, 6, 3]\n",
      "前5个标签: [9, 4, 3, 6, 3]\n",
      "评估损失: 0.3301，准确率: 0.9688\n",
      "评估损失: 0.3301，准确率: 0.9688\n",
      "\n",
      "Eval Batch 126\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 0, 0, 1, 1]\n",
      "前5个标签: [1, 0, 0, 1, 1]\n",
      "评估损失: 0.2332，准确率: 1.0000\n",
      "评估损失: 0.2332，准确率: 1.0000\n",
      "\n",
      "Eval Batch 127\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 0, 2, 5, 8]\n",
      "前5个标签: [7, 0, 2, 5, 8]\n",
      "评估损失: 0.3024，准确率: 0.9688\n",
      "评估损失: 0.3024，准确率: 0.9688\n",
      "\n",
      "Eval Batch 128\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 3, 2, 7, 2]\n",
      "前5个标签: [8, 3, 2, 7, 2]\n",
      "评估损失: 0.2535，准确率: 0.9688\n",
      "评估损失: 0.2535，准确率: 0.9688\n",
      "\n",
      "Eval Batch 129\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 9, 7, 5, 6]\n",
      "前5个标签: [3, 9, 7, 5, 6]\n",
      "评估损失: 0.2416，准确率: 1.0000\n",
      "评估损失: 0.2416，准确率: 1.0000\n",
      "\n",
      "Eval Batch 130\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 3, 9, 3]\n",
      "前5个标签: [6, 2, 3, 9, 3]\n",
      "评估损失: 0.2853，准确率: 0.9688\n",
      "评估损失: 0.2853，准确率: 0.9688\n",
      "\n",
      "Eval Batch 131\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 4, 1, 5]\n",
      "前5个标签: [4, 6, 4, 1, 5]\n",
      "评估损失: 0.3362，准确率: 0.9062\n",
      "评估损失: 0.3362，准确率: 0.9062\n",
      "\n",
      "Eval Batch 132\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 7, 5, 0, 7]\n",
      "前5个标签: [9, 7, 5, 0, 7]\n",
      "评估损失: 0.2473，准确率: 0.9375\n",
      "评估损失: 0.2473，准确率: 0.9375\n",
      "\n",
      "Eval Batch 133\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 9, 4, 9, 2]\n",
      "前5个标签: [3, 9, 4, 9, 2]\n",
      "评估损失: 0.2955，准确率: 0.9688\n",
      "评估损失: 0.2955，准确率: 0.9688\n",
      "\n",
      "Eval Batch 134\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 7, 8, 4, 1]\n",
      "前5个标签: [3, 2, 8, 4, 1]\n",
      "评估损失: 0.3179，准确率: 0.9375\n",
      "评估损失: 0.3179，准确率: 0.9375\n",
      "\n",
      "Eval Batch 135\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 9, 7, 5, 4]\n",
      "前5个标签: [0, 9, 7, 5, 4]\n",
      "评估损失: 0.2846，准确率: 0.9688\n",
      "评估损失: 0.2846，准确率: 0.9688\n",
      "\n",
      "Eval Batch 136\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 0, 2, 5, 5]\n",
      "前5个标签: [3, 0, 2, 5, 5]\n",
      "评估损失: 0.2456，准确率: 0.9375\n",
      "评估损失: 0.2456，准确率: 0.9375\n",
      "\n",
      "Eval Batch 137\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 2, 1, 2, 6]\n",
      "前5个标签: [2, 2, 1, 2, 6]\n",
      "评估损失: 0.2470，准确率: 1.0000\n",
      "评估损失: 0.2470，准确率: 1.0000\n",
      "\n",
      "Eval Batch 138\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 9, 2, 8, 5]\n",
      "前5个标签: [6, 9, 2, 8, 5]\n",
      "评估损失: 0.2526，准确率: 1.0000\n",
      "评估损失: 0.2526，准确率: 1.0000\n",
      "\n",
      "Eval Batch 139\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 6, 1, 2, 8]\n",
      "前5个标签: [0, 6, 1, 2, 8]\n",
      "评估损失: 0.2290，准确率: 1.0000\n",
      "评估损失: 0.2290，准确率: 1.0000\n",
      "\n",
      "Eval Batch 140\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 2, 4, 6]\n",
      "前5个标签: [9, 4, 2, 4, 6]\n",
      "评估损失: 0.3183，准确率: 0.9375\n",
      "评估损失: 0.3183，准确率: 0.9375\n",
      "\n",
      "Eval Batch 141\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 8, 4, 0, 1]\n",
      "前5个标签: [6, 8, 4, 0, 1]\n",
      "评估损失: 0.1821，准确率: 1.0000\n",
      "评估损失: 0.1821，准确率: 1.0000\n",
      "\n",
      "Eval Batch 142\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 8, 2, 6, 5]\n",
      "前5个标签: [4, 8, 2, 6, 5]\n",
      "评估损失: 0.3629，准确率: 0.9062\n",
      "评估损失: 0.3629，准确率: 0.9062\n",
      "\n",
      "Eval Batch 143\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 5, 7, 6, 1]\n",
      "前5个标签: [4, 5, 7, 6, 1]\n",
      "评估损失: 0.1928，准确率: 1.0000\n",
      "评估损失: 0.1928，准确率: 1.0000\n",
      "\n",
      "Eval Batch 144\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 4, 9, 0, 7]\n",
      "前5个标签: [8, 4, 9, 0, 7]\n",
      "评估损失: 0.1927，准确率: 1.0000\n",
      "评估损失: 0.1927，准确率: 1.0000\n",
      "\n",
      "Eval Batch 145\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 0, 0, 1, 9]\n",
      "前5个标签: [8, 0, 0, 1, 9]\n",
      "评估损失: 0.2204，准确率: 1.0000\n",
      "评估损失: 0.2204，准确率: 1.0000\n",
      "\n",
      "Eval Batch 146\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 9, 1, 0, 1]\n",
      "前5个标签: [0, 9, 1, 0, 1]\n",
      "评估损失: 0.2205，准确率: 1.0000\n",
      "评估损失: 0.2205，准确率: 1.0000\n",
      "\n",
      "Eval Batch 147\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 9, 8, 1]\n",
      "前5个标签: [6, 2, 9, 8, 1]\n",
      "评估损失: 0.2129，准确率: 0.9688\n",
      "评估损失: 0.2129，准确率: 0.9688\n",
      "\n",
      "Eval Batch 148\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 4, 0, 5]\n",
      "前5个标签: [7, 8, 4, 0, 3]\n",
      "评估损失: 0.3521，准确率: 0.9375\n",
      "评估损失: 0.3521，准确率: 0.9375\n",
      "\n",
      "Eval Batch 149\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 9, 3, 5, 4]\n",
      "前5个标签: [4, 9, 3, 5, 4]\n",
      "评估损失: 0.2182，准确率: 0.9688\n",
      "评估损失: 0.2182，准确率: 0.9688\n",
      "\n",
      "Eval Batch 150\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 2, 3, 4, 0]\n",
      "前5个标签: [7, 2, 3, 4, 0]\n",
      "评估损失: 0.2872，准确率: 0.9688\n",
      "评估损失: 0.2872，准确率: 0.9688\n",
      "\n",
      "Eval Batch 151\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 3, 0, 9, 3]\n",
      "前5个标签: [6, 3, 0, 9, 3]\n",
      "评估损失: 0.2847，准确率: 1.0000\n",
      "评估损失: 0.2847，准确率: 1.0000\n",
      "\n",
      "Eval Batch 152\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 7, 4, 5, 7]\n",
      "前5个标签: [1, 7, 4, 5, 7]\n",
      "评估损失: 0.2805，准确率: 0.9688\n",
      "评估损失: 0.2805，准确率: 0.9688\n",
      "\n",
      "Eval Batch 153\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 6, 2, 7]\n",
      "前5个标签: [4, 6, 6, 2, 7]\n",
      "评估损失: 0.2462，准确率: 1.0000\n",
      "评估损失: 0.2462，准确率: 1.0000\n",
      "\n",
      "Eval Batch 154\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 1, 1, 1]\n",
      "前5个标签: [3, 4, 1, 1, 1]\n",
      "评估损失: 0.2781，准确率: 0.9688\n",
      "评估损失: 0.2781，准确率: 0.9688\n",
      "\n",
      "Eval Batch 155\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 2, 2, 9, 2]\n",
      "前5个标签: [8, 2, 2, 9, 2]\n",
      "评估损失: 0.2195，准确率: 0.9688\n",
      "评估损失: 0.2195，准确率: 0.9688\n",
      "\n",
      "Eval Batch 156\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 7, 7, 2, 3]\n",
      "前5个标签: [0, 7, 7, 2, 3]\n",
      "评估损失: 0.1717，准确率: 0.9688\n",
      "评估损失: 0.1717，准确率: 0.9688\n",
      "\n",
      "Eval Batch 157\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 1, 9, 4, 3]\n",
      "前5个标签: [2, 1, 9, 4, 3]\n",
      "评估损失: 0.1125，准确率: 1.0000\n",
      "评估损失: 0.1125，准确率: 1.0000\n",
      "\n",
      "Eval Batch 158\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 6, 7, 8, 9]\n",
      "前5个标签: [5, 6, 7, 8, 9]\n",
      "评估损失: 0.1803，准确率: 0.9688\n",
      "评估损失: 0.1803，准确率: 0.9688\n",
      "\n",
      "Eval Batch 159\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 1, 1, 1]\n",
      "前5个标签: [6, 2, 1, 1, 1]\n",
      "评估损失: 0.1652，准确率: 1.0000\n",
      "评估损失: 0.1652，准确率: 1.0000\n",
      "\n",
      "Eval Batch 160\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 7, 7, 4, 0]\n",
      "前5个标签: [2, 7, 7, 4, 0]\n",
      "评估损失: 0.1555，准确率: 1.0000\n",
      "评估损失: 0.1555，准确率: 1.0000\n",
      "\n",
      "Eval Batch 161\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 6, 7, 0, 1]\n",
      "前5个标签: [5, 6, 7, 0, 1]\n",
      "评估损失: 0.1774，准确率: 1.0000\n",
      "评估损失: 0.1774，准确率: 1.0000\n",
      "\n",
      "Eval Batch 162\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 3, 1, 5, 8]\n",
      "前5个标签: [8, 3, 1, 5, 8]\n",
      "评估损失: 0.1319，准确率: 1.0000\n",
      "评估损失: 0.1319，准确率: 1.0000\n",
      "\n",
      "Eval Batch 163\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 2, 6, 9, 9]\n",
      "前5个标签: [2, 2, 6, 9, 9]\n",
      "评估损失: 0.1381，准确率: 1.0000\n",
      "评估损失: 0.1381，准确率: 1.0000\n",
      "\n",
      "Eval Batch 164\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 0, 2, 0, 1]\n",
      "前5个标签: [3, 0, 2, 0, 1]\n",
      "评估损失: 0.1679，准确率: 1.0000\n",
      "评估损失: 0.1679，准确率: 1.0000\n",
      "\n",
      "Eval Batch 165\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 1, 2, 3, 4]\n",
      "前5个标签: [0, 1, 2, 3, 4]\n",
      "评估损失: 0.1509，准确率: 1.0000\n",
      "评估损失: 0.1509，准确率: 1.0000\n",
      "\n",
      "Eval Batch 166\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 7, 1, 9, 1]\n",
      "前5个标签: [4, 7, 1, 9, 1]\n",
      "评估损失: 0.1998，准确率: 0.9688\n",
      "评估损失: 0.1998，准确率: 0.9688\n",
      "\n",
      "Eval Batch 167\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 3, 5, 4]\n",
      "前5个标签: [9, 4, 3, 5, 4]\n",
      "评估损失: 0.1217，准确率: 1.0000\n",
      "评估损失: 0.1217，准确率: 1.0000\n",
      "\n",
      "Eval Batch 168\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 9, 6, 8, 8]\n",
      "前5个标签: [8, 9, 6, 8, 8]\n",
      "评估损失: 0.1538，准确率: 1.0000\n",
      "评估损失: 0.1538，准确率: 1.0000\n",
      "\n",
      "Eval Batch 169\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 5, 6, 7]\n",
      "前5个标签: [3, 4, 5, 6, 7]\n",
      "评估损失: 0.1010，准确率: 1.0000\n",
      "评估损失: 0.1010，准确率: 1.0000\n",
      "\n",
      "Eval Batch 170\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 1, 0, 4]\n",
      "前5个标签: [4, 6, 1, 0, 4]\n",
      "评估损失: 0.1343，准确率: 1.0000\n",
      "评估损失: 0.1343，准确率: 1.0000\n",
      "\n",
      "Eval Batch 171\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 5, 4, 2, 4]\n",
      "前5个标签: [3, 5, 4, 2, 4]\n",
      "评估损失: 0.0709，准确率: 1.0000\n",
      "评估损失: 0.0709，准确率: 1.0000\n",
      "\n",
      "Eval Batch 172\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 0, 1, 2, 3]\n",
      "前5个标签: [3, 0, 1, 2, 3]\n",
      "评估损失: 0.1868，准确率: 1.0000\n",
      "评估损失: 0.1868，准确率: 1.0000\n",
      "\n",
      "Eval Batch 173\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 9, 3, 6, 7]\n",
      "前5个标签: [2, 9, 3, 6, 7]\n",
      "评估损失: 0.1920，准确率: 1.0000\n",
      "评估损失: 0.1920，准确率: 1.0000\n",
      "\n",
      "Eval Batch 174\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 8, 5, 5, 5]\n",
      "前5个标签: [6, 8, 5, 5, 5]\n",
      "评估损失: 0.2145，准确率: 1.0000\n",
      "评估损失: 0.2145，准确率: 1.0000\n",
      "\n",
      "Eval Batch 175\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 0, 1]\n",
      "前5个标签: [7, 8, 9, 0, 1]\n",
      "评估损失: 0.2401，准确率: 1.0000\n",
      "评估损失: 0.2401，准确率: 1.0000\n",
      "\n",
      "Eval Batch 176\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 5, 3, 3, 2]\n",
      "前5个标签: [5, 5, 2, 3, 2]\n",
      "评估损失: 0.3661，准确率: 0.9062\n",
      "评估损失: 0.3661，准确率: 0.9062\n",
      "\n",
      "Eval Batch 177\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 1, 2, 5]\n",
      "前5个标签: [4, 6, 1, 2, 5]\n",
      "评估损失: 0.2467，准确率: 0.9688\n",
      "评估损失: 0.2467，准确率: 0.9688\n",
      "\n",
      "Eval Batch 178\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 5, 4, 1, 3]\n",
      "前5个标签: [4, 5, 4, 1, 3]\n",
      "评估损失: 0.1995，准确率: 1.0000\n",
      "评估损失: 0.1995，准确率: 1.0000\n",
      "\n",
      "Eval Batch 179\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 0, 1]\n",
      "前5个标签: [7, 8, 9, 0, 1]\n",
      "评估损失: 0.2785，准确率: 0.9688\n",
      "评估损失: 0.2785，准确率: 0.9688\n",
      "\n",
      "Eval Batch 180\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 2, 1, 2, 3]\n",
      "前5个标签: [3, 2, 1, 2, 3]\n",
      "评估损失: 0.1213，准确率: 1.0000\n",
      "评估损失: 0.1213，准确率: 1.0000\n",
      "\n",
      "Eval Batch 181\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 1, 7, 3]\n",
      "前5个标签: [4, 6, 1, 7, 3]\n",
      "评估损失: 0.1221，准确率: 1.0000\n",
      "评估损失: 0.1221，准确率: 1.0000\n",
      "\n",
      "Eval Batch 182\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 6, 0, 5]\n",
      "前5个标签: [3, 4, 6, 0, 0]\n",
      "评估损失: 0.2236，准确率: 0.9688\n",
      "评估损失: 0.2236，准确率: 0.9688\n",
      "\n",
      "Eval Batch 183\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 8, 7, 1, 3]\n",
      "前5个标签: [9, 8, 7, 1, 3]\n",
      "评估损失: 0.2150，准确率: 0.9688\n",
      "评估损失: 0.2150，准确率: 0.9688\n",
      "\n",
      "Eval Batch 184\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 1, 0, 5, 3]\n",
      "前5个标签: [4, 1, 0, 5, 3]\n",
      "评估损失: 0.1971，准确率: 1.0000\n",
      "评估损失: 0.1971，准确率: 1.0000\n",
      "\n",
      "Eval Batch 185\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 5, 4, 2]\n",
      "前5个标签: [6, 2, 5, 4, 2]\n",
      "评估损失: 0.2371，准确率: 0.9688\n",
      "评估损失: 0.2371，准确率: 0.9688\n",
      "\n",
      "Eval Batch 186\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 1, 2, 8, 4]\n",
      "前5个标签: [0, 1, 2, 3, 4]\n",
      "评估损失: 0.2968，准确率: 0.9688\n",
      "评估损失: 0.2968，准确率: 0.9688\n",
      "\n",
      "Eval Batch 187\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 4, 0, 7]\n",
      "前5个标签: [1, 5, 4, 0, 7]\n",
      "评估损失: 0.4131，准确率: 0.9688\n",
      "评估损失: 0.4131，准确率: 0.9688\n",
      "\n",
      "Eval Batch 188\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 7, 8, 4, 6]\n",
      "前5个标签: [0, 7, 8, 4, 6]\n",
      "评估损失: 0.2251，准确率: 1.0000\n",
      "评估损失: 0.2251，准确率: 1.0000\n",
      "\n",
      "Eval Batch 189\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 7, 2, 2]\n",
      "前5个标签: [7, 8, 7, 2, 2]\n",
      "评估损失: 0.2555，准确率: 1.0000\n",
      "评估损失: 0.2555，准确率: 1.0000\n",
      "\n",
      "Eval Batch 190\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 9, 0, 1, 2]\n",
      "前5个标签: [8, 9, 0, 1, 2]\n",
      "评估损失: 0.2674，准确率: 0.9688\n",
      "评估损失: 0.2674，准确率: 0.9688\n",
      "\n",
      "Eval Batch 191\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 6, 0, 1, 3]\n",
      "前5个标签: [9, 6, 0, 1, 3]\n",
      "评估损失: 0.1336，准确率: 1.0000\n",
      "评估损失: 0.1336，准确率: 1.0000\n",
      "\n",
      "Eval Batch 192\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 8, 5, 7, 5]\n",
      "前5个标签: [4, 8, 5, 7, 5]\n",
      "评估损失: 0.2289，准确率: 0.9688\n",
      "评估损失: 0.2289，准确率: 0.9688\n",
      "\n",
      "Eval Batch 193\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 3, 8, 6, 2]\n",
      "前5个标签: [4, 3, 8, 6, 2]\n",
      "评估损失: 0.0987，准确率: 1.0000\n",
      "评估损失: 0.0987，准确率: 1.0000\n",
      "\n",
      "Eval Batch 194\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 0, 8]\n",
      "前5个标签: [7, 8, 9, 0, 8]\n",
      "评估损失: 0.1253，准确率: 1.0000\n",
      "评估损失: 0.1253，准确率: 1.0000\n",
      "\n",
      "Eval Batch 195\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 0, 7, 7, 5]\n",
      "前5个标签: [2, 0, 7, 7, 5]\n",
      "评估损失: 0.0959，准确率: 1.0000\n",
      "评估损失: 0.0959，准确率: 1.0000\n",
      "\n",
      "Eval Batch 196\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 2, 8, 1]\n",
      "前5个标签: [3, 4, 2, 8, 1]\n",
      "评估损失: 0.0749，准确率: 1.0000\n",
      "评估损失: 0.0749，准确率: 1.0000\n",
      "\n",
      "Eval Batch 197\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 2, 7, 7, 1]\n",
      "前5个标签: [8, 2, 7, 7, 1]\n",
      "评估损失: 0.0991，准确率: 1.0000\n",
      "评估损失: 0.0991，准确率: 1.0000\n",
      "\n",
      "Eval Batch 198\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 2, 1, 7, 2]\n",
      "前5个标签: [8, 2, 1, 7, 2]\n",
      "评估损失: 0.1596，准确率: 0.9375\n",
      "评估损失: 0.1596，准确率: 0.9375\n",
      "\n",
      "Eval Batch 199\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 4, 3, 3, 8]\n",
      "前5个标签: [5, 4, 3, 3, 8]\n",
      "评估损失: 0.1379，准确率: 1.0000\n",
      "评估损失: 0.1379，准确率: 1.0000\n",
      "\n",
      "Eval Batch 200\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 9, 6, 8, 8]\n",
      "前5个标签: [0, 9, 6, 8, 8]\n",
      "评估损失: 0.2109，准确率: 0.9688\n",
      "评估损失: 0.2109，准确率: 0.9688\n",
      "\n",
      "Eval Batch 201\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 7, 8, 9]\n",
      "前5个标签: [3, 4, 7, 8, 9]\n",
      "评估损失: 0.1179，准确率: 1.0000\n",
      "评估损失: 0.1179，准确率: 1.0000\n",
      "\n",
      "Eval Batch 202\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 3, 2, 8, 1]\n",
      "前5个标签: [8, 3, 2, 8, 1]\n",
      "评估损失: 0.1424，准确率: 1.0000\n",
      "评估损失: 0.1424，准确率: 1.0000\n",
      "\n",
      "Eval Batch 203\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 2, 6, 2, 5]\n",
      "前5个标签: [9, 2, 6, 2, 5]\n",
      "评估损失: 0.1211，准确率: 1.0000\n",
      "评估损失: 0.1211，准确率: 1.0000\n",
      "\n",
      "Eval Batch 204\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 4, 5, 6, 5]\n",
      "前5个标签: [2, 4, 5, 6, 0]\n",
      "评估损失: 0.3336，准确率: 0.9062\n",
      "评估损失: 0.3336，准确率: 0.9062\n",
      "\n",
      "Eval Batch 205\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 3, 2, 3, 3]\n",
      "前5个标签: [9, 7, 2, 3, 3]\n",
      "评估损失: 0.5253，准确率: 0.8750\n",
      "评估损失: 0.5253，准确率: 0.8750\n",
      "\n",
      "Eval Batch 206\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 3, 2, 8, 6]\n",
      "前5个标签: [9, 3, 2, 8, 6]\n",
      "评估损失: 0.4399，准确率: 0.9688\n",
      "评估损失: 0.4399，准确率: 0.9688\n",
      "\n",
      "Eval Batch 207\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 2, 4, 9, 1]\n",
      "前5个标签: [3, 8, 4, 9, 1]\n",
      "评估损失: 0.2859，准确率: 0.9375\n",
      "评估损失: 0.2859，准确率: 0.9375\n",
      "\n",
      "Eval Batch 208\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 8, 9, 8, 4]\n",
      "前5个标签: [9, 8, 9, 8, 4]\n",
      "评估损失: 0.1106，准确率: 1.0000\n",
      "评估损失: 0.1106，准确率: 1.0000\n",
      "\n",
      "Eval Batch 209\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 4, 3, 6, 9]\n",
      "前5个标签: [1, 4, 3, 6, 9]\n",
      "评估损失: 0.1725，准确率: 0.9688\n",
      "评估损失: 0.1725，准确率: 0.9688\n",
      "\n",
      "Eval Batch 210\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 2, 3, 4, 7]\n",
      "前5个标签: [1, 2, 3, 4, 7]\n",
      "评估损失: 0.2052，准确率: 1.0000\n",
      "评估损失: 0.2052，准确率: 1.0000\n",
      "\n",
      "Eval Batch 211\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 0, 2, 8, 7]\n",
      "前5个标签: [0, 0, 2, 8, 7]\n",
      "评估损失: 0.2550，准确率: 0.9688\n",
      "评估损失: 0.2550，准确率: 0.9688\n",
      "\n",
      "Eval Batch 212\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 2, 0, 9, 5]\n",
      "前5个标签: [9, 2, 0, 9, 5]\n",
      "评估损失: 0.1511，准确率: 1.0000\n",
      "评估损失: 0.1511，准确率: 1.0000\n",
      "\n",
      "Eval Batch 213\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 9, 0, 1, 2]\n",
      "前5个标签: [8, 9, 0, 1, 2]\n",
      "评估损失: 0.1375，准确率: 1.0000\n",
      "评估损失: 0.1375，准确率: 1.0000\n",
      "\n",
      "Eval Batch 214\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 2, 8, 8, 7]\n",
      "前5个标签: [1, 2, 8, 8, 7]\n",
      "评估损失: 0.1166，准确率: 1.0000\n",
      "评估损失: 0.1166，准确率: 1.0000\n",
      "\n",
      "Eval Batch 215\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 6, 3, 1, 5]\n",
      "前5个标签: [5, 6, 3, 1, 5]\n",
      "评估损失: 0.1205，准确率: 1.0000\n",
      "评估损失: 0.1205，准确率: 1.0000\n",
      "\n",
      "Eval Batch 216\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 1, 9, 4, 9]\n",
      "前5个标签: [2, 1, 9, 4, 9]\n",
      "评估损失: 0.1306，准确率: 1.0000\n",
      "评估损失: 0.1306，准确率: 1.0000\n",
      "\n",
      "Eval Batch 217\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 7, 9, 0, 1]\n",
      "前5个标签: [7, 8, 9, 0, 1]\n",
      "评估损失: 0.1967，准确率: 0.9688\n",
      "评估损失: 0.1967，准确率: 0.9688\n",
      "\n",
      "Eval Batch 218\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 5, 0, 0, 9]\n",
      "前5个标签: [1, 5, 0, 0, 9]\n",
      "评估损失: 0.1730，准确率: 1.0000\n",
      "评估损失: 0.1730，准确率: 1.0000\n",
      "\n",
      "Eval Batch 219\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 3, 8, 2]\n",
      "前5个标签: [9, 4, 3, 8, 2]\n",
      "评估损失: 0.1802，准确率: 1.0000\n",
      "评估损失: 0.1802，准确率: 1.0000\n",
      "\n",
      "Eval Batch 220\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 7, 6, 9, 9]\n",
      "前5个标签: [3, 7, 6, 9, 9]\n",
      "评估损失: 0.1772，准确率: 0.9688\n",
      "评估损失: 0.1772，准确率: 0.9688\n",
      "\n",
      "Eval Batch 221\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 1, 2, 3, 4]\n",
      "前5个标签: [0, 1, 2, 3, 4]\n",
      "评估损失: 0.1610，准确率: 1.0000\n",
      "评估损失: 0.1610，准确率: 1.0000\n",
      "\n",
      "Eval Batch 222\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 6, 9, 9, 5]\n",
      "前5个标签: [3, 6, 9, 9, 5]\n",
      "评估损失: 0.1454，准确率: 1.0000\n",
      "评估损失: 0.1454，准确率: 1.0000\n",
      "\n",
      "Eval Batch 223\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 1, 0, 3]\n",
      "前5个标签: [9, 4, 1, 0, 3]\n",
      "评估损失: 0.1321，准确率: 1.0000\n",
      "评估损失: 0.1321，准确率: 1.0000\n",
      "\n",
      "Eval Batch 224\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 4, 3, 1, 6]\n",
      "前5个标签: [0, 4, 3, 1, 6]\n",
      "评估损失: 0.1305，准确率: 1.0000\n",
      "评估损失: 0.1305，准确率: 1.0000\n",
      "\n",
      "Eval Batch 225\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 4, 0, 0, 7]\n",
      "前5个标签: [8, 4, 0, 0, 7]\n",
      "评估损失: 0.2116，准确率: 0.9688\n",
      "评估损失: 0.2116，准确率: 0.9688\n",
      "\n",
      "Eval Batch 226\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 3, 8, 2, 9]\n",
      "前5个标签: [1, 3, 8, 2, 9]\n",
      "评估损失: 0.2338，准确率: 0.9688\n",
      "评估损失: 0.2338，准确率: 0.9688\n",
      "\n",
      "Eval Batch 227\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 8, 2, 7, 7]\n",
      "前5个标签: [5, 8, 2, 7, 7]\n",
      "评估损失: 0.1642，准确率: 1.0000\n",
      "评估损失: 0.1642，准确率: 1.0000\n",
      "\n",
      "Eval Batch 228\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 1, 7]\n",
      "前5个标签: [7, 8, 9, 1, 7]\n",
      "评估损失: 0.1392，准确率: 1.0000\n",
      "评估损失: 0.1392，准确率: 1.0000\n",
      "\n",
      "Eval Batch 229\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 3, 0, 6, 4]\n",
      "前5个标签: [2, 3, 0, 6, 4]\n",
      "评估损失: 0.1969，准确率: 0.9688\n",
      "评估损失: 0.1969，准确率: 0.9688\n",
      "\n",
      "Eval Batch 230\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 7, 0, 2]\n",
      "前5个标签: [9, 4, 7, 0, 2]\n",
      "评估损失: 0.1883，准确率: 1.0000\n",
      "评估损失: 0.1883，准确率: 1.0000\n",
      "\n",
      "Eval Batch 231\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 5, 4, 1, 3]\n",
      "前5个标签: [7, 5, 4, 1, 3]\n",
      "评估损失: 0.1598，准确率: 1.0000\n",
      "评估损失: 0.1598，准确率: 1.0000\n",
      "\n",
      "Eval Batch 232\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 4, 9, 6, 8]\n",
      "前5个标签: [1, 4, 9, 6, 8]\n",
      "评估损失: 0.1850，准确率: 1.0000\n",
      "评估损失: 0.1850，准确率: 1.0000\n",
      "\n",
      "Eval Batch 233\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 2, 3, 9, 7]\n",
      "前5个标签: [4, 2, 3, 9, 7]\n",
      "评估损失: 0.1443，准确率: 1.0000\n",
      "评估损失: 0.1443，准确率: 1.0000\n",
      "\n",
      "Eval Batch 234\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 9, 7, 0, 2]\n",
      "前5个标签: [4, 9, 7, 0, 2]\n",
      "评估损失: 0.1696，准确率: 1.0000\n",
      "评估损失: 0.1696，准确率: 1.0000\n",
      "\n",
      "Eval Batch 235\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 5, 6, 7, 8]\n",
      "前5个标签: [4, 5, 6, 7, 8]\n",
      "评估损失: 0.1224，准确率: 1.0000\n",
      "评估损失: 0.1224，准确率: 1.0000\n",
      "\n",
      "Eval Batch 236\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 8, 3, 0, 1]\n",
      "前5个标签: [8, 8, 3, 0, 1]\n",
      "评估损失: 0.1812，准确率: 1.0000\n",
      "评估损失: 0.1812，准确率: 1.0000\n",
      "\n",
      "Eval Batch 237\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 6, 8, 2, 9]\n",
      "前5个标签: [7, 6, 8, 2, 9]\n",
      "评估损失: 0.1434，准确率: 1.0000\n",
      "评估损失: 0.1434，准确率: 1.0000\n",
      "\n",
      "Eval Batch 238\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 0, 1, 2, 3]\n",
      "前5个标签: [9, 0, 1, 2, 3]\n",
      "评估损失: 0.1239，准确率: 1.0000\n",
      "评估损失: 0.1239，准确率: 1.0000\n",
      "\n",
      "Eval Batch 239\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 5, 7, 9, 9]\n",
      "前5个标签: [7, 5, 7, 9, 9]\n",
      "评估损失: 0.1231，准确率: 1.0000\n",
      "评估损失: 0.1231，准确率: 1.0000\n",
      "\n",
      "Eval Batch 240\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 6, 9, 2, 6]\n",
      "前5个标签: [9, 6, 9, 2, 6]\n",
      "评估损失: 0.1824，准确率: 1.0000\n",
      "评估损失: 0.1824，准确率: 1.0000\n",
      "\n",
      "Eval Batch 241\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 8, 3, 5, 2]\n",
      "前5个标签: [6, 8, 3, 5, 2]\n",
      "评估损失: 0.1798，准确率: 1.0000\n",
      "评估损失: 0.1798，准确率: 1.0000\n",
      "\n",
      "Eval Batch 242\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 0, 1]\n",
      "前5个标签: [7, 8, 9, 0, 1]\n",
      "评估损失: 0.1238，准确率: 1.0000\n",
      "评估损失: 0.1238，准确率: 1.0000\n",
      "\n",
      "Eval Batch 243\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 5, 6, 5, 0]\n",
      "前5个标签: [8, 5, 6, 5, 0]\n",
      "评估损失: 0.1966，准确率: 1.0000\n",
      "评估损失: 0.1966，准确率: 1.0000\n",
      "\n",
      "Eval Batch 244\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 5, 0, 1, 1]\n",
      "前5个标签: [5, 5, 0, 1, 1]\n",
      "评估损失: 0.2310，准确率: 1.0000\n",
      "评估损失: 0.2310，准确率: 1.0000\n",
      "\n",
      "Eval Batch 245\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 3, 5, 6, 7]\n",
      "前5个标签: [2, 3, 5, 6, 7]\n",
      "评估损失: 0.3508，准确率: 0.9688\n",
      "评估损失: 0.3508，准确率: 0.9688\n",
      "\n",
      "Eval Batch 246\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 0, 9, 3, 2]\n",
      "前5个标签: [8, 0, 9, 3, 2]\n",
      "评估损失: 0.2627，准确率: 1.0000\n",
      "评估损失: 0.2627，准确率: 1.0000\n",
      "\n",
      "Eval Batch 247\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 3, 6, 0, 7]\n",
      "前5个标签: [6, 3, 6, 0, 7]\n",
      "评估损失: 0.2922，准确率: 0.9688\n",
      "评估损失: 0.2922，准确率: 0.9688\n",
      "\n",
      "Eval Batch 248\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 5, 6, 7]\n",
      "前5个标签: [3, 4, 5, 6, 7]\n",
      "评估损失: 0.1491，准确率: 1.0000\n",
      "评估损失: 0.1491，准确率: 1.0000\n",
      "\n",
      "Eval Batch 249\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 1, 6, 8, 4]\n",
      "前5个标签: [3, 1, 6, 8, 4]\n",
      "评估损失: 0.1945，准确率: 1.0000\n",
      "评估损失: 0.1945，准确率: 1.0000\n",
      "\n",
      "Eval Batch 250\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 9, 9, 7, 1]\n",
      "前5个标签: [4, 9, 9, 7, 1]\n",
      "评估损失: 0.1969，准确率: 1.0000\n",
      "评估损失: 0.1969，准确率: 1.0000\n",
      "\n",
      "Eval Batch 251\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 5, 5, 2]\n",
      "前5个标签: [3, 4, 5, 5, 2]\n",
      "评估损失: 0.2031，准确率: 1.0000\n",
      "评估损失: 0.2031，准确率: 1.0000\n",
      "\n",
      "Eval Batch 252\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 9, 0, 1]\n",
      "前5个标签: [7, 8, 9, 0, 1]\n",
      "评估损失: 0.4341，准确率: 0.9688\n",
      "评估损失: 0.4341，准确率: 0.9688\n",
      "\n",
      "Eval Batch 253\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 8, 0, 1, 1]\n",
      "前5个标签: [6, 8, 0, 1, 1]\n",
      "评估损失: 0.2470，准确率: 1.0000\n",
      "评估损失: 0.2470，准确率: 1.0000\n",
      "\n",
      "Eval Batch 254\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 2, 3, 4, 5]\n",
      "前5个标签: [1, 2, 3, 4, 5]\n",
      "评估损失: 0.1396，准确率: 1.0000\n",
      "评估损失: 0.1396，准确率: 1.0000\n",
      "\n",
      "Eval Batch 255\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 2, 3, 0, 1]\n",
      "前5个标签: [5, 2, 3, 0, 1]\n",
      "评估损失: 0.1275，准确率: 1.0000\n",
      "评估损失: 0.1275，准确率: 1.0000\n",
      "\n",
      "Eval Batch 256\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 4, 0, 0, 6]\n",
      "前5个标签: [5, 4, 0, 0, 6]\n",
      "评估损失: 0.1094，准确率: 1.0000\n",
      "评估损失: 0.1094，准确率: 1.0000\n",
      "\n",
      "Eval Batch 257\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 2, 3, 9, 0]\n",
      "前5个标签: [5, 2, 3, 9, 0]\n",
      "评估损失: 0.1894，准确率: 1.0000\n",
      "评估损失: 0.1894，准确率: 1.0000\n",
      "\n",
      "Eval Batch 258\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 7, 8, 9, 0]\n",
      "前5个标签: [6, 7, 8, 9, 0]\n",
      "评估损失: 0.1527，准确率: 1.0000\n",
      "评估损失: 0.1527，准确率: 1.0000\n",
      "\n",
      "Eval Batch 259\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 1, 3, 6, 2]\n",
      "前5个标签: [9, 1, 3, 6, 2]\n",
      "评估损失: 0.1612，准确率: 1.0000\n",
      "评估损失: 0.1612，准确率: 1.0000\n",
      "\n",
      "Eval Batch 260\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 7, 9, 2, 1]\n",
      "前5个标签: [2, 7, 9, 2, 1]\n",
      "评估损失: 0.1700，准确率: 0.9688\n",
      "评估损失: 0.1700，准确率: 0.9688\n",
      "\n",
      "Eval Batch 261\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 2, 3, 4, 7]\n",
      "前5个标签: [1, 2, 3, 4, 7]\n",
      "评估损失: 0.1680，准确率: 1.0000\n",
      "评估损失: 0.1680，准确率: 1.0000\n",
      "\n",
      "Eval Batch 262\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 6, 5, 7, 0]\n",
      "前5个标签: [8, 6, 5, 7, 0]\n",
      "评估损失: 0.1780，准确率: 1.0000\n",
      "评估损失: 0.1780，准确率: 1.0000\n",
      "\n",
      "Eval Batch 263\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 7, 1, 3, 1]\n",
      "前5个标签: [4, 7, 1, 3, 1]\n",
      "评估损失: 0.0996，准确率: 1.0000\n",
      "评估损失: 0.0996，准确率: 1.0000\n",
      "\n",
      "Eval Batch 264\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 1, 2, 3, 4]\n",
      "前5个标签: [0, 1, 2, 3, 4]\n",
      "评估损失: 0.1447，准确率: 1.0000\n",
      "评估损失: 0.1447，准确率: 1.0000\n",
      "\n",
      "Eval Batch 265\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 0, 2, 3, 4]\n",
      "前5个标签: [7, 0, 2, 3, 4]\n",
      "评估损失: 0.2781，准确率: 1.0000\n",
      "评估损失: 0.2781，准确率: 1.0000\n",
      "\n",
      "Eval Batch 266\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 0, 0, 6, 6]\n",
      "前5个标签: [7, 0, 0, 6, 6]\n",
      "评估损失: 0.3288，准确率: 0.9375\n",
      "评估损失: 0.3288，准确率: 0.9375\n",
      "\n",
      "Eval Batch 267\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 1, 6, 8, 0]\n",
      "前5个标签: [2, 1, 6, 8, 0]\n",
      "评估损失: 0.1155，准确率: 1.0000\n",
      "评估损失: 0.1155，准确率: 1.0000\n",
      "\n",
      "Eval Batch 268\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 4, 5, 6, 6]\n",
      "前5个标签: [0, 4, 5, 6, 6]\n",
      "评估损失: 0.1115，准确率: 1.0000\n",
      "评估损失: 0.1115，准确率: 1.0000\n",
      "\n",
      "Eval Batch 269\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 8, 4, 0, 2]\n",
      "前5个标签: [7, 8, 4, 0, 2]\n",
      "评估损失: 0.1390，准确率: 1.0000\n",
      "评估损失: 0.1390，准确率: 1.0000\n",
      "\n",
      "Eval Batch 270\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 7, 9, 5, 6]\n",
      "前5个标签: [9, 7, 9, 5, 6]\n",
      "评估损失: 0.1093，准确率: 1.0000\n",
      "评估损失: 0.1093，准确率: 1.0000\n",
      "\n",
      "Eval Batch 271\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 2, 3, 4, 5]\n",
      "前5个标签: [1, 2, 3, 4, 5]\n",
      "评估损失: 0.1036，准确率: 1.0000\n",
      "评估损失: 0.1036，准确率: 1.0000\n",
      "\n",
      "Eval Batch 272\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 9, 3, 2, 1]\n",
      "前5个标签: [2, 9, 3, 2, 1]\n",
      "评估损失: 0.1156，准确率: 1.0000\n",
      "评估损失: 0.1156，准确率: 1.0000\n",
      "\n",
      "Eval Batch 273\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 5, 0, 6, 1]\n",
      "前5个标签: [7, 5, 0, 6, 1]\n",
      "评估损失: 0.1553，准确率: 1.0000\n",
      "评估损失: 0.1553，准确率: 1.0000\n",
      "\n",
      "Eval Batch 274\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 6, 4, 6, 0]\n",
      "前5个标签: [1, 6, 4, 6, 0]\n",
      "评估损失: 0.0880，准确率: 1.0000\n",
      "评估损失: 0.0880，准确率: 1.0000\n",
      "\n",
      "Eval Batch 275\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 3, 4, 5, 6]\n",
      "前5个标签: [2, 3, 4, 5, 6]\n",
      "评估损失: 0.0758，准确率: 1.0000\n",
      "评估损失: 0.0758，准确率: 1.0000\n",
      "\n",
      "Eval Batch 276\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 7, 5, 5, 4]\n",
      "前5个标签: [4, 7, 5, 5, 4]\n",
      "评估损失: 0.0909，准确率: 1.0000\n",
      "评估损失: 0.0909，准确率: 1.0000\n",
      "\n",
      "Eval Batch 277\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 0, 8, 3, 0]\n",
      "前5个标签: [3, 0, 8, 3, 0]\n",
      "评估损失: 0.1070，准确率: 1.0000\n",
      "评估损失: 0.1070，准确率: 1.0000\n",
      "\n",
      "Eval Batch 278\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 9, 4, 9, 9]\n",
      "前5个标签: [6, 9, 4, 9, 9]\n",
      "评估损失: 0.0994，准确率: 1.0000\n",
      "评估损失: 0.0994，准确率: 1.0000\n",
      "\n",
      "Eval Batch 279\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 0, 1, 7, 8]\n",
      "前5个标签: [9, 0, 1, 7, 8]\n",
      "评估损失: 0.1016，准确率: 1.0000\n",
      "评估损失: 0.1016，准确率: 1.0000\n",
      "\n",
      "Eval Batch 280\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 4, 9, 8, 5]\n",
      "前5个标签: [4, 4, 9, 8, 5]\n",
      "评估损失: 0.0859，准确率: 1.0000\n",
      "评估损失: 0.0859，准确率: 1.0000\n",
      "\n",
      "Eval Batch 281\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 4, 9, 1, 6]\n",
      "前5个标签: [0, 4, 9, 1, 6]\n",
      "评估损失: 0.2334，准确率: 0.9062\n",
      "评估损失: 0.2334，准确率: 0.9062\n",
      "\n",
      "Eval Batch 282\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 1, 9, 3, 9]\n",
      "前5个标签: [7, 1, 9, 3, 9]\n",
      "评估损失: 0.1912，准确率: 1.0000\n",
      "评估损失: 0.1912，准确率: 1.0000\n",
      "\n",
      "Eval Batch 283\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 9, 6, 3, 0]\n",
      "前5个标签: [3, 9, 6, 3, 0]\n",
      "评估损失: 0.1903，准确率: 0.9688\n",
      "评估损失: 0.1903，准确率: 0.9688\n",
      "\n",
      "Eval Batch 284\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 9, 1, 6, 8]\n",
      "前5个标签: [8, 9, 1, 6, 8]\n",
      "评估损失: 0.1483，准确率: 1.0000\n",
      "评估损失: 0.1483，准确率: 1.0000\n",
      "\n",
      "Eval Batch 285\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 1, 6, 2, 1]\n",
      "前5个标签: [1, 1, 6, 2, 1]\n",
      "评估损失: 0.1367，准确率: 1.0000\n",
      "评估损失: 0.1367，准确率: 1.0000\n",
      "\n",
      "Eval Batch 286\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 9, 2, 1, 3]\n",
      "前5个标签: [4, 9, 2, 1, 3]\n",
      "评估损失: 0.1682，准确率: 0.9688\n",
      "评估损失: 0.1682，准确率: 0.9688\n",
      "\n",
      "Eval Batch 287\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 6, 7, 8, 9]\n",
      "前5个标签: [5, 6, 7, 8, 9]\n",
      "评估损失: 0.0989，准确率: 1.0000\n",
      "评估损失: 0.0989，准确率: 1.0000\n",
      "\n",
      "Eval Batch 288\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 3, 9, 3, 0]\n",
      "前5个标签: [9, 3, 9, 3, 0]\n",
      "评估损失: 0.0937，准确率: 1.0000\n",
      "评估损失: 0.0937，准确率: 1.0000\n",
      "\n",
      "Eval Batch 289\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 1, 9, 6, 9]\n",
      "前5个标签: [7, 1, 9, 6, 9]\n",
      "评估损失: 0.1263，准确率: 1.0000\n",
      "评估损失: 0.1263，准确率: 1.0000\n",
      "\n",
      "Eval Batch 290\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 0, 1, 3, 4]\n",
      "前5个标签: [8, 0, 1, 3, 4]\n",
      "评估损失: 0.1139，准确率: 1.0000\n",
      "评估损失: 0.1139，准确率: 1.0000\n",
      "\n",
      "Eval Batch 291\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 1, 7, 5, 8]\n",
      "前5个标签: [6, 1, 7, 5, 8]\n",
      "评估损失: 0.1248，准确率: 1.0000\n",
      "评估损失: 0.1248，准确率: 1.0000\n",
      "\n",
      "Eval Batch 292\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 1, 2, 4, 1]\n",
      "前5个标签: [4, 1, 2, 4, 1]\n",
      "评估损失: 0.1114，准确率: 1.0000\n",
      "评估损失: 0.1114，准确率: 1.0000\n",
      "\n",
      "Eval Batch 293\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 0, 1, 2, 3]\n",
      "前5个标签: [9, 0, 1, 2, 3]\n",
      "评估损失: 0.1450，准确率: 1.0000\n",
      "评估损失: 0.1450，准确率: 1.0000\n",
      "\n",
      "Eval Batch 294\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 3, 8, 4, 4]\n",
      "前5个标签: [9, 3, 8, 4, 4]\n",
      "评估损失: 0.1710，准确率: 1.0000\n",
      "评估损失: 0.1710，准确率: 1.0000\n",
      "\n",
      "Eval Batch 295\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 6, 2, 1, 1]\n",
      "前5个标签: [0, 6, 2, 1, 1]\n",
      "评估损失: 0.1502，准确率: 1.0000\n",
      "评估损失: 0.1502，准确率: 1.0000\n",
      "\n",
      "Eval Batch 296\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 4, 3, 6, 2]\n",
      "前5个标签: [9, 4, 3, 6, 2]\n",
      "评估损失: 0.1224，准确率: 1.0000\n",
      "评估损失: 0.1224，准确率: 1.0000\n",
      "\n",
      "Eval Batch 297\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 7, 8, 9, 0]\n",
      "前5个标签: [6, 7, 8, 9, 0]\n",
      "评估损失: 0.1891，准确率: 1.0000\n",
      "评估损失: 0.1891，准确率: 1.0000\n",
      "\n",
      "Eval Batch 298\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 4, 4, 9, 1]\n",
      "前5个标签: [3, 4, 4, 9, 1]\n",
      "评估损失: 0.2002，准确率: 1.0000\n",
      "评估损失: 0.2002，准确率: 1.0000\n",
      "\n",
      "Eval Batch 299\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 2, 1, 9, 8]\n",
      "前5个标签: [6, 2, 1, 9, 8]\n",
      "评估损失: 0.1827，准确率: 1.0000\n",
      "评估损失: 0.1827，准确率: 1.0000\n",
      "\n",
      "Eval Batch 300\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [5, 0, 1, 2, 3]\n",
      "前5个标签: [5, 0, 1, 2, 3]\n",
      "评估损失: 0.2242，准确率: 1.0000\n",
      "评估损失: 0.2242，准确率: 1.0000\n",
      "\n",
      "Eval Batch 301\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 0, 2, 2, 3]\n",
      "前5个标签: [6, 0, 0, 2, 3]\n",
      "评估损失: 0.3333，准确率: 0.9375\n",
      "评估损失: 0.3333，准确率: 0.9375\n",
      "\n",
      "Eval Batch 302\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [7, 6, 0, 8, 9]\n",
      "前5个标签: [2, 6, 0, 8, 9]\n",
      "评估损失: 0.3595，准确率: 0.9062\n",
      "评估损失: 0.3595，准确率: 0.9062\n",
      "\n",
      "Eval Batch 303\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [2, 3, 5, 1, 8]\n",
      "前5个标签: [2, 3, 6, 1, 2]\n",
      "评估损失: 0.2793，准确率: 0.9375\n",
      "评估损失: 0.2793，准确率: 0.9375\n",
      "\n",
      "Eval Batch 304\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [4, 6, 6, 7, 8]\n",
      "前5个标签: [4, 5, 6, 7, 8]\n",
      "评估损失: 0.3758，准确率: 0.9062\n",
      "评估损失: 0.3758，准确率: 0.9062\n",
      "\n",
      "Eval Batch 305\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [1, 0, 3, 0, 4]\n",
      "前5个标签: [1, 0, 3, 0, 4]\n",
      "评估损失: 0.2136，准确率: 0.9688\n",
      "评估损失: 0.2136，准确率: 0.9688\n",
      "\n",
      "Eval Batch 306\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [3, 6, 6, 1, 1]\n",
      "前5个标签: [4, 6, 6, 1, 1]\n",
      "评估损失: 0.2131，准确率: 0.9688\n",
      "评估损失: 0.2131，准确率: 0.9688\n",
      "\n",
      "Eval Batch 307\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 9, 0, 8, 3]\n",
      "前5个标签: [8, 9, 0, 8, 3]\n",
      "评估损失: 0.3153，准确率: 0.9375\n",
      "评估损失: 0.3153，准确率: 0.9375\n",
      "\n",
      "Eval Batch 308\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [9, 8, 6, 7, 3]\n",
      "前5个标签: [9, 8, 6, 7, 3]\n",
      "评估损失: 0.2241，准确率: 1.0000\n",
      "评估损失: 0.2241，准确率: 1.0000\n",
      "\n",
      "Eval Batch 309\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [6, 3, 9, 3, 8]\n",
      "前5个标签: [6, 3, 9, 9, 8]\n",
      "评估损失: 0.2434，准确率: 0.9375\n",
      "评估损失: 0.2434，准确率: 0.9375\n",
      "\n",
      "Eval Batch 310\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [8, 6, 4, 1, 9]\n",
      "前5个标签: [8, 6, 4, 1, 9]\n",
      "评估损失: 0.1243，准确率: 1.0000\n",
      "评估损失: 0.1243，准确率: 1.0000\n",
      "\n",
      "Eval Batch 311\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "模型输出形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "前5个预测: [0, 6, 2, 1, 1]\n",
      "前5个标签: [0, 6, 2, 1, 1]\n",
      "评估损失: 0.2014，准确率: 0.9688\n",
      "评估损失: 0.2014，准确率: 0.9688\n",
      "\n",
      "Eval Batch 312\n",
      "输入形状: torch.Size([16, 1, 28, 28])，标签形状: torch.Size([16])\n",
      "模型输出形状: torch.Size([16, 10])\n",
      "预测结果形状: torch.Size([16])\n",
      "前5个预测: [1, 2, 3, 4, 5]\n",
      "前5个标签: [1, 2, 3, 4, 5]\n",
      "评估损失: 0.1947，准确率: 0.9375\n",
      "评估损失: 0.1947，准确率: 0.9375\n"
     ]
    }
   ],
   "source": [
    "# 6. 执行评估（禁用梯度计算以提高效率）\n",
    "total_loss = 0.0\n",
    "total_correct = 0\n",
    "total_samples = 0\n",
    "\n",
    "with torch.no_grad():  # 关闭梯度计算，节省内存和计算资源\n",
    "    for batch_idx, (x, y) in enumerate(test_loader):\n",
    "        # --------------------------\n",
    "        # 1. 检查输入数据（同训练）\n",
    "        # --------------------------\n",
    "        print(f\"\\nEval Batch {batch_idx}\")\n",
    "        print(f\"输入形状: {x.shape}，标签形状: {y.shape}\")\n",
    "        \n",
    "        # --------------------------\n",
    "        # 2. 前向传播 + 检查输出\n",
    "        # ------------------------\n",
    "        logits = model(x)\n",
    "        print(f\"模型输出形状: {logits.shape}\")  # 预期: (batch_size, 10)\n",
    "        \n",
    "        # --------------------------\n",
    "        # 3. 计算预测结果 + 检查匹配性\n",
    "        # --------------------------\n",
    "        preds = logits.argmax(dim=1)  # 取概率最大的类别（0-9）\n",
    "        print(f\"预测结果形状: {preds.shape}\")  # 预期: (batch_size,)\n",
    "        print(f\"前5个预测: {preds[:5].tolist()}\")\n",
    "        print(f\"前5个标签: {y[:5].tolist()}\")  # 对比预测和标签是否有重合（合理情况下应部分一致）\n",
    "\n",
    "        # --------------------------\n",
    "        # 4. 检查评估指标（损失/准确率）\n",
    "        # --------------------------\n",
    "        # 计算损失\n",
    "        loss = criterion(logits, y)\n",
    "        total_loss += loss.item() * x.size(0)  # 累计总损失（乘batch_size）\n",
    "        acc = (preds == y).float().mean()  # 准确率\n",
    "        print(f\"评估损失: {loss.item():.4f}，准确率: {acc.item():.4f}\")  # 准确率应逐渐提升（如随机模型≈10%，好模型>95%）\n",
    "\n",
    "        # 计算预测准确率\n",
    "        preds = logits.argmax(dim=1)  # 取概率最大的类别\n",
    "        total_correct += (preds == y).sum().item()\n",
    "        total_samples += x.size(0)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算平均损失和准确率\n",
    "avg_loss = total_loss / total_samples\n",
    "accuracy = total_correct / total_samples\n",
    "\n",
    "print(f\"评估结果：平均损失={avg_loss:.4f}，准确率={accuracy:.4f}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Experiment 2 验证Loss的计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Eval Batch 0\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([7, 2, 1, 0, 4, 1, 4, 9, 5, 9, 0, 6, 9, 0, 1, 5, 9, 7, 3, 4, 9, 6, 6, 5,\n",
      "        4, 0, 7, 4, 0, 1, 3, 1])\n",
      "模型输出的logits形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "预测结果内容: tensor([7, 2, 1, 0, 4, 1, 4, 9, 5, 9, 0, 6, 9, 0, 1, 5, 9, 7, 5, 4, 9, 6, 6, 5,\n",
      "        4, 0, 7, 4, 0, 1, 3, 1])\n",
      "loss函数输出的形状: torch.Size([])\n",
      "loss函数输出的值: 0.23035994172096252\n",
      "\n",
      "Eval Batch 1\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([3, 4, 7, 2, 7, 1, 2, 1, 1, 7, 4, 2, 3, 5, 1, 2, 4, 4, 6, 3, 5, 5, 6, 0,\n",
      "        4, 1, 9, 5, 7, 8, 9, 3])\n",
      "模型输出的logits形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "预测结果内容: tensor([3, 4, 7, 2, 7, 1, 2, 1, 1, 7, 4, 2, 3, 5, 1, 2, 4, 4, 6, 3, 5, 5, 6, 0,\n",
      "        4, 1, 9, 5, 7, 8, 9, 3])\n",
      "loss函数输出的形状: torch.Size([])\n",
      "loss函数输出的值: 0.18469694256782532\n",
      "\n",
      "Eval Batch 2\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([7, 4, 6, 4, 3, 0, 7, 0, 2, 9, 1, 7, 3, 2, 9, 7, 7, 6, 2, 7, 8, 4, 7, 3,\n",
      "        6, 1, 3, 6, 9, 3, 1, 4])\n",
      "模型输出的logits形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "预测结果内容: tensor([7, 4, 6, 4, 3, 0, 7, 0, 2, 9, 1, 7, 3, 2, 9, 7, 7, 6, 2, 7, 8, 4, 7, 3,\n",
      "        6, 1, 3, 6, 9, 3, 1, 4])\n",
      "loss函数输出的形状: torch.Size([])\n",
      "loss函数输出的值: 0.2003478854894638\n",
      "\n",
      "Eval Batch 3\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([1, 7, 6, 9, 6, 0, 5, 4, 9, 9, 2, 1, 9, 4, 8, 7, 3, 9, 7, 4, 4, 4, 9, 2,\n",
      "        5, 4, 7, 6, 7, 9, 0, 5])\n",
      "模型输出的logits形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "预测结果内容: tensor([1, 7, 6, 9, 6, 0, 5, 4, 9, 9, 2, 1, 9, 4, 8, 7, 3, 9, 7, 9, 4, 4, 9, 2,\n",
      "        5, 4, 7, 6, 7, 9, 0, 5])\n",
      "loss函数输出的形状: torch.Size([])\n",
      "loss函数输出的值: 0.25590795278549194\n",
      "\n",
      "Eval Batch 4\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([8, 5, 6, 6, 5, 7, 8, 1, 0, 1, 6, 4, 6, 7, 3, 1, 7, 1, 8, 2, 0, 2, 9, 9,\n",
      "        5, 5, 1, 5, 6, 0, 3, 4])\n",
      "模型输出的logits形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "预测结果内容: tensor([8, 5, 6, 6, 5, 7, 8, 1, 0, 1, 6, 4, 6, 7, 3, 1, 7, 1, 8, 2, 0, 9, 9, 9,\n",
      "        5, 5, 1, 5, 6, 0, 3, 4])\n",
      "loss函数输出的形状: torch.Size([])\n",
      "loss函数输出的值: 0.1888899952173233\n",
      "\n",
      "Eval Batch 5\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([4, 6, 5, 4, 6, 5, 4, 5, 1, 4, 4, 7, 2, 3, 2, 7, 1, 8, 1, 8, 1, 8, 5, 0,\n",
      "        8, 9, 2, 5, 0, 1, 1, 1])\n",
      "模型输出的logits形状: torch.Size([32, 10])\n",
      "预测结果形状: torch.Size([32])\n",
      "预测结果内容: tensor([4, 6, 5, 4, 6, 5, 4, 5, 1, 4, 4, 7, 2, 3, 2, 7, 1, 8, 1, 8, 1, 8, 5, 0,\n",
      "        3, 9, 2, 5, 0, 1, 1, 1])\n",
      "loss函数输出的形状: torch.Size([])\n",
      "loss函数输出的值: 0.29888802766799927\n",
      "\n",
      "Eval Batch 6\n",
      "输入形状: torch.Size([32, 1, 28, 28])，标签形状: torch.Size([32])\n",
      "标签内容: tensor([0, 9, 0, 3, 1, 6, 4, 2, 3, 6, 1, 1, 1, 3, 9, 5, 2, 9, 4, 5, 9, 3, 9, 0,\n",
      "        3, 6, 5, 5, 7, 2, 2, 7])\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[1;32m/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb Cell 10\u001b[0m line \u001b[0;36m1\n\u001b[1;32m      <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=7'>8</a>\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m标签内容: \u001b[39m\u001b[39m{\u001b[39;00my\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m)\n\u001b[1;32m      <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=8'>9</a>\u001b[0m \u001b[39m# --------------------------\u001b[39;00m\n\u001b[1;32m     <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=9'>10</a>\u001b[0m \u001b[39m# 2. 前向传播 + 检查输出\u001b[39;00m\n\u001b[1;32m     <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=10'>11</a>\u001b[0m \u001b[39m# ------------------------\u001b[39;00m\n\u001b[0;32m---> <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=11'>12</a>\u001b[0m logits \u001b[39m=\u001b[39m model(x)\n\u001b[1;32m     <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=12'>13</a>\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m模型输出的logits形状: \u001b[39m\u001b[39m{\u001b[39;00mlogits\u001b[39m.\u001b[39mshape\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m)  \u001b[39m# 预期: (batch_size, 10)\u001b[39;00m\n\u001b[1;32m     <a href='vscode-notebook-cell://localhost:8080/root/MyCode/digital-handwriting-recognition/load_and_eval.ipynb#X11sdnNjb2RlLXJlbW90ZQ%3D%3D?line=14'>15</a>\u001b[0m \u001b[39m# 转化为概率大小\u001b[39;00m\n",
      "File \u001b[0;32m/opt/anaconda3/envs/science39/lib/python3.9/site-packages/torch/nn/modules/module.py:1130\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *input, **kwargs)\u001b[0m\n\u001b[1;32m   1126\u001b[0m \u001b[39m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m   1127\u001b[0m \u001b[39m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m   1128\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m (\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_backward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_pre_hooks \u001b[39mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m   1129\u001b[0m         \u001b[39mor\u001b[39;00m _global_forward_hooks \u001b[39mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1130\u001b[0m     \u001b[39mreturn\u001b[39;00m forward_call(\u001b[39m*\u001b[39;49m\u001b[39minput\u001b[39;49m, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m   1131\u001b[0m \u001b[39m# Do not call functions when jit is used\u001b[39;00m\n\u001b[1;32m   1132\u001b[0m full_backward_hooks, non_full_backward_hooks \u001b[39m=\u001b[39m [], []\n",
      "File \u001b[0;32m~/MyCode/digital-handwriting-recognition/model.py:44\u001b[0m, in \u001b[0;36mDigitClassifier.forward\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m     41\u001b[0m x \u001b[39m=\u001b[39m F\u001b[39m.\u001b[39mrelu(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mconv1(x))  \u001b[39m# 输出形状：[B, 32, 28, 28]\u001b[39;00m\n\u001b[1;32m     43\u001b[0m \u001b[39m# 第二层卷积 + ReLU激活\u001b[39;00m\n\u001b[0;32m---> 44\u001b[0m x \u001b[39m=\u001b[39m F\u001b[39m.\u001b[39mrelu(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mconv2(x))  \u001b[39m# 输出形状：[B, 16, 28, 28]\u001b[39;00m\n\u001b[1;32m     46\u001b[0m \u001b[39m# 第三层卷积 + ReLU激活\u001b[39;00m\n\u001b[1;32m     47\u001b[0m x \u001b[39m=\u001b[39m F\u001b[39m.\u001b[39mrelu(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mconv3(x))  \u001b[39m# 输出形状：[B, 8, 28, 28]\u001b[39;00m\n",
      "File \u001b[0;32m/opt/anaconda3/envs/science39/lib/python3.9/site-packages/torch/nn/modules/module.py:1130\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *input, **kwargs)\u001b[0m\n\u001b[1;32m   1126\u001b[0m \u001b[39m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m   1127\u001b[0m \u001b[39m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m   1128\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m (\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_backward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_pre_hooks \u001b[39mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m   1129\u001b[0m         \u001b[39mor\u001b[39;00m _global_forward_hooks \u001b[39mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1130\u001b[0m     \u001b[39mreturn\u001b[39;00m forward_call(\u001b[39m*\u001b[39;49m\u001b[39minput\u001b[39;49m, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m   1131\u001b[0m \u001b[39m# Do not call functions when jit is used\u001b[39;00m\n\u001b[1;32m   1132\u001b[0m full_backward_hooks, non_full_backward_hooks \u001b[39m=\u001b[39m [], []\n",
      "File \u001b[0;32m/opt/anaconda3/envs/science39/lib/python3.9/site-packages/torch/nn/modules/conv.py:457\u001b[0m, in \u001b[0;36mConv2d.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m    456\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mforward\u001b[39m(\u001b[39mself\u001b[39m, \u001b[39minput\u001b[39m: Tensor) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Tensor:\n\u001b[0;32m--> 457\u001b[0m     \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_conv_forward(\u001b[39minput\u001b[39;49m, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mweight, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mbias)\n",
      "File \u001b[0;32m/opt/anaconda3/envs/science39/lib/python3.9/site-packages/torch/nn/modules/conv.py:453\u001b[0m, in \u001b[0;36mConv2d._conv_forward\u001b[0;34m(self, input, weight, bias)\u001b[0m\n\u001b[1;32m    449\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpadding_mode \u001b[39m!=\u001b[39m \u001b[39m'\u001b[39m\u001b[39mzeros\u001b[39m\u001b[39m'\u001b[39m:\n\u001b[1;32m    450\u001b[0m     \u001b[39mreturn\u001b[39;00m F\u001b[39m.\u001b[39mconv2d(F\u001b[39m.\u001b[39mpad(\u001b[39minput\u001b[39m, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_reversed_padding_repeated_twice, mode\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpadding_mode),\n\u001b[1;32m    451\u001b[0m                     weight, bias, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mstride,\n\u001b[1;32m    452\u001b[0m                     _pair(\u001b[39m0\u001b[39m), \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdilation, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mgroups)\n\u001b[0;32m--> 453\u001b[0m \u001b[39mreturn\u001b[39;00m F\u001b[39m.\u001b[39;49mconv2d(\u001b[39minput\u001b[39;49m, weight, bias, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mstride,\n\u001b[1;32m    454\u001b[0m                 \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mpadding, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mdilation, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mgroups)\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "with torch.no_grad():  # 关闭梯度计算，节省内存和计算资源\n",
    "    for batch_idx, (x, y) in enumerate(test_loader):\n",
    "        # --------------------------\n",
    "        # 1. 检查输入数据（同训练）\n",
    "        # --------------------------\n",
    "        print(f\"\\nEval Batch {batch_idx}\")\n",
    "        print(f\"输入形状: {x.shape}，标签形状: {y.shape}\")\n",
    "        print(f\"标签内容: {y}\")\n",
    "        # --------------------------\n",
    "        # 2. 前向传播 + 检查输出\n",
    "        # ------------------------\n",
    "        logits = model(x)\n",
    "        print(f\"模型输出的logits形状: {logits.shape}\")  \n",
    "        # 预期: (batch_size, 10)\n",
    "        \n",
    "        # 转化为概率大小\n",
    "        preds = logits.argmax(dim=1)  # 取概率最大的类别（0-9）\n",
    "        print(f\"预测结果形状: {preds.shape}\")  # 预期: (batch_size,)\n",
    "        print(f\"预测结果内容: {preds}\")  # 预期: (batch_size,)\n",
    "\n",
    "        \n",
    "        # --------------------------\n",
    "        # 4. 检查评估指标（损失/准确率）\n",
    "        # --------------------------\n",
    "        # 计算损失\n",
    "        loss = criterion(logits, y)\n",
    "        print(f\"loss函数输出的形状: {loss.shape}\")  # 预期: (batch_size, 10)\n",
    "        print(f\"loss函数输出的值: {loss}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "science39",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
